from django.db import models
from apps.system.models import Upload


# Create your models here.

class AdornService(models.Model):
    name = models.CharField(verbose_name='服务名称', max_length=150)
    code = models.CharField(verbose_name='服务代码', max_length=10, unique=True)
    icon = models.CharField(verbose_name='图标', max_length=10, null=True)
    describe = models.TextField(verbose_name='服务说明')
    phone = models.CharField(verbose_name='服务电话', max_length=11)
    image = models.ForeignKey(Upload, verbose_name='图片', on_delete=models.PROTECT, null=True, blank=True)

    class Meta:
        db_table = 'adorn_service'
        verbose_name = '装修服务'
        ordering = ('-id',)


class OrderService(models.Model):
    adornService = models.ForeignKey(AdornService, verbose_name='对应服务', on_delete=models.PROTECT)
    name = models.CharField(verbose_name='姓名', max_length=50, null=True, blank=True)
    mobile = models.CharField(verbose_name='手机号', max_length=11)
    address = models.CharField(verbose_name='地址', max_length=150, null=True, blank=True)
    create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)

    class Meta:
        db_table = 'adorn_order_service'
        verbose_name = '预定服务'
        ordering = ('-create_time',)
